<include file="public@header" />
</head>

<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li class=""><a href="{:url('team/index',array('id'=>$id))}">暂定决算单</a></li>
            <li class="active"><a>采购供应商决算新增</a></li>
        </ul>
        <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('team/doadd')}"
            enctype="multipart/form-data">

            <div class="form-group">

                <label for="js-smtpsecure" class="col-sm-2 control-label">
                    供应商姓名
                </label>
                <div class="col-md-6 col-sm-10">
                    <select name="lid" id="nameSelect" class="form-control">
                        <option value=""></option>
                        <volist name="some" id="v">
                            <option value="{$v.id}" data-type="{$v['attrName']}">{$v['name']}</option>
                        </volist>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label for="js-smtpsecure" class="col-sm-2 control-label">
                    供应商
                </label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" id="teampDisplay" class="form-control" readonly>
                </div>
            </div>

            <input type="hidden" name="eid" value="{$id}">
            <input type="hidden" name="type" value="{$type}">

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                    <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
                </div>
            </div>
        </form>
    </div>
    <script src="__STATIC__/js/admin.js"></script>
    <script>
        document.getElementById('nameSelect').addEventListener('change',function(){
            const selectedOption = this.options[this.selectedIndex];
            const typeValue = selectedOption.getAttribute('data-type');
            document.getElementById('teampDisplay').value = typeValue || ''
        });
    </script>
</body>

</html>